//
//  HighLightsTableViewCell.m
//  PlayerWorld
//
//  Created by 1 on 16/5/3.
//  Copyright © 2016年 刘成. All rights reserved.
//
#define UISCREEN_WIDTH  [UIScreen mainScreen].bounds.size.width
#define UISCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height

#import "HighLightsTableViewCell.h"

@implementation HighLightsTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {

        // 用户头像
        _userImageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 30, 30)];
        [self.contentView addSubview:_userImageView];

        // 用户名称
        _userLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(_userImageView.frame)+10, 10, UISCREEN_WIDTH/2-10-30, 30)];
        _userLabel.font = [UIFont systemFontOfSize:16];
        _userLabel.textAlignment = NSTextAlignmentLeft;
        [_userLabel setTextColor:[UIColor grayColor]];
        [self.contentView addSubview:_userLabel];

        // 余额标签
        _balancelabel = [[UILabel alloc]initWithFrame:CGRectMake(UISCREEN_WIDTH/2, 10, UISCREEN_WIDTH/2-10, 30)];
        _balancelabel.font = [UIFont systemFontOfSize:16];
        _balancelabel.textAlignment = NSTextAlignmentRight;
        [_balancelabel setTextColor:[UIColor grayColor]];
         [self.contentView addSubview:_balancelabel];
        
        //集合button标签
        NSArray *titlesArray = @[@"快速充值",@"闪电提现",@"投注记录"];
        NSArray *imagesArray = @[@"icon_in", @"icon_out",@"icon_betting"];
        for (int i = 0; i < 3; i++) {
            CGFloat width;
            if (i < 3) {
                width = UISCREEN_WIDTH/3;
            }
            _userbuttons = [UIButton buttonWithType:UIButtonTypeCustom];
            _userbuttons.frame = CGRectMake(UISCREEN_WIDTH/3*i, CGRectGetMaxY(_userImageView.frame)+10, width, 80);
            [_userbuttons setImage:[UIImage imageNamed:imagesArray[i]] forState:UIControlStateNormal];
            [_userbuttons setBackgroundColor:[UIColor whiteColor]];
            _userbuttons.titleLabel.font = [UIFont systemFontOfSize:15];
            _userbuttons.imageEdgeInsets = UIEdgeInsetsMake(-10,0,0,0);
            [_userbuttons setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
            _userbuttons.tag = i+10;
            _btnTag = _userbuttons.tag;
            UILabel *labels = [[UILabel alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_userbuttons.imageView.frame)+5, width, 10)];
            labels.text = titlesArray[i];
            labels.font = [UIFont systemFontOfSize:12];
            labels.textAlignment = NSTextAlignmentCenter;
            
            [_userbuttons addSubview:labels];
             [self.contentView addSubview:_userbuttons];
            
            // 彩种按钮
            UIButton *colorbutton = [[UIButton alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_userbuttons.frame)+10, UISCREEN_WIDTH/2, 30)];
            [colorbutton setImage:[UIImage imageNamed:@"icon_add"] forState:UIControlStateNormal];
            [colorbutton setTitle:@"  热门彩种" forState:UIControlStateNormal];
            [colorbutton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
            colorbutton.titleLabel.font = [UIFont systemFontOfSize:15];
            colorbutton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
            colorbutton.contentEdgeInsets = UIEdgeInsetsMake(0,10, 0, 0);
             [self.contentView addSubview:colorbutton];
            
            // 自定义标签
//            _custombutton = [UIButton buttonWithType:UIButtonTypeCustom];
//            _custombutton = [[UIButton alloc]initWithFrame:CGRectMake(UISCREEN_WIDTH/2, CGRectGetMaxY(_userbuttons.frame)+10, UISCREEN_WIDTH/2, 30)];
//            [_custombutton setTitle:@"自定义" forState:UIControlStateNormal];
//            [_custombutton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
//            _custombutton.titleLabel.font = [UIFont systemFontOfSize:14];
//            _custombutton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
//            _custombutton.contentEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 20);
//             [self.contentView addSubview:_custombutton];
            
            // 重庆时时彩
            _colorbutton1 = [UIButton buttonWithType:UIButtonTypeCustom];
            _colorbutton1.frame = CGRectMake(0, CGRectGetMaxY(colorbutton.frame)+10, UISCREEN_WIDTH/2, 70);
            [_colorbutton1 setTitle:@"重庆时时彩" forState:UIControlStateNormal];
            [_colorbutton1 setBackgroundColor:[UIColor whiteColor]];
            [_colorbutton1 setImage:[UIImage imageNamed:@"logo_ssc_sm"] forState:UIControlStateNormal];
            _colorbutton1.titleLabel.font = [UIFont systemFontOfSize:14];
            [_colorbutton1 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
             [self.contentView addSubview:_colorbutton1];
            
            // 山东11选5
            _colorbutton2 = [UIButton buttonWithType:UIButtonTypeCustom];
            _colorbutton2.frame = CGRectMake(UISCREEN_WIDTH/2, CGRectGetMaxY(colorbutton.frame)+10, UISCREEN_WIDTH/2, 70);
            [_colorbutton2 setTitle:@"天津时时彩" forState:UIControlStateNormal];
            [_colorbutton2 setBackgroundColor:[UIColor whiteColor]];
            [_colorbutton2 setImage:[UIImage imageNamed:@"logo_11x5_sm"] forState:UIControlStateNormal];
            _colorbutton2.titleLabel.font = [UIFont systemFontOfSize:14];
            [_colorbutton2 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
             [self.contentView addSubview:_colorbutton2];
            
            // 福彩3D
            _colorbutton3 = [UIButton buttonWithType:UIButtonTypeCustom];
            _colorbutton3.frame = CGRectMake(0, CGRectGetMaxY(_colorbutton1.frame), UISCREEN_WIDTH/2, 70);
            [_colorbutton3 setTitle:@"快乐二分彩" forState:UIControlStateNormal];
            [_colorbutton3 setBackgroundColor:[UIColor whiteColor]];
            [_colorbutton3 setImage:[UIImage imageNamed:@"logo_fc3d_sm"] forState:UIControlStateNormal];
            _colorbutton3.titleLabel.font = [UIFont systemFontOfSize:14];
            [_colorbutton3 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
             [self.contentView addSubview:_colorbutton3];
            
            // 体彩排列3
            _colorbutton4 = [UIButton buttonWithType:UIButtonTypeCustom];
            _colorbutton4.frame = CGRectMake(UISCREEN_WIDTH/2, CGRectGetMaxY(_colorbutton1.frame), UISCREEN_WIDTH/2, 70);
            [_colorbutton4 setTitle:@"快乐五分彩" forState:UIControlStateNormal];
            [_colorbutton4 setBackgroundColor:[UIColor whiteColor]];
            [_colorbutton4 setImage:[UIImage imageNamed:@"logo_tcp3_sm"] forState:UIControlStateNormal];
            _colorbutton4.titleLabel.font = [UIFont systemFontOfSize:14];
            [_colorbutton4 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
             [self.contentView addSubview:_colorbutton4];
            }
        }
    return self;
}

@end
